#include "transcoder.h"

namespace MCCommon
{

Transcoder::Transcoder
(   
    const std::string& toTranscode
)
{
    fAsciiForm = 0;
    fUnicodeForm = xercesc::XMLString::transcode(toTranscode.c_str());
}

Transcoder::Transcoder   
(
    const XMLCh* const toTranscode
)
{   
    fUnicodeForm = 0;
    fAsciiForm = xercesc::XMLString::transcode(toTranscode);
} 

Transcoder::~Transcoder()
{
    xercesc::XMLString::release(&fUnicodeForm);
    xercesc::XMLString::release(&fAsciiForm);
}

const XMLCh* 
Transcoder::unicodeForm() const
{
    return fUnicodeForm;
}

const std::string 
Transcoder::asciiForm() const
{
    std::string str(fAsciiForm);
    return str;
}  

} // end of namespace MCXML_NAMESPACE.